var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function n() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  FactionMemberDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.dataArr = []),
        (t.fenDuoArr = []),
        t.label_fac_mem_down.on(Laya.Event.CLICK, t, t.onDidMemDownClick),
        t.btn_fac_mem_sure.on(Laya.Event.CLICK, t, t.onDidMemOperationAction),
        t.btn_fac_mem_cancle.on(Laya.Event.CLICK, t, t.onDidMemOperationAction),
        (t.list_bangpai_member.vScrollBarSkin = ""),
        (t.list_bangpai_member.selectEnable = !0),
        t.list_bangpai_member.on(Laya.Event.CLICK, t, t.onBangPaiMemberAction),
        t.label_fenduo_down.on(Laya.Event.CLICK, t, t.onDidFenDuoDownClick),
        (t.list_mem_fenduo.vScrollBarSkin = ""),
        (t.list_mem_fenduo.selectEnable = !0),
        t.list_mem_fenduo.on(Laya.Event.CLICK, t, t.onBangPaiFenDuoAction),
        WebSocketService.addListener({
          caller: t,
          code: 1233,
          method: t.onLoadMemableManagerData,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openMemberManView = function (e) {
        return (
          null == this.memberDia &&
            ((this.memberDia = new t()), (this.memberDia.zOrder = 1e3)),
          this.memberDia.popup(!0),
          (this.memberDia.jsonObj = e),
          (this.memberDia.label_mem_new_pos.text = "任命【" + e.n + "】为"),
          -1 != e.t.indexOf("(")
            ? (this.memberDia.label_fac_mem_name.text = "成员")
            : (this.memberDia.label_fac_mem_name.text = e.t),
          (this.memberDia.list_bangpai_member.visible = !1),
          (this.memberDia.label_fenduo_name.visible = !1),
          (this.memberDia.label_fenduo_down.visible = !1),
          (this.memberDia.label_fenduo_title.visible = !1),
          (this.memberDia.list_mem_fenduo.visible = !1),
          this.memberDia
        );
      }),
      (t.prototype.onDidMemDownClick = function (e) {
        (this.dataArr = [
          { 2: "教主" },
          { 3: "左护法" },
          { 4: "右护法" },
          { 5: "舵主" },
          { 6: "精英" },
        ]),
          (this.resultArr = []);
        for (var t, i = 0; i < this.dataArr.length; i++) {
          var n = i + 2;
          (t = { item_member_title: { text: this.dataArr[i][n] } }),
            this.resultArr.push(t);
        }
        (this.list_bangpai_member.visible = !0),
          (this.list_bangpai_member.dataSource = this.resultArr);
      }),
      (t.prototype.onDidFenDuoDownClick = function (e) {
        (this.fenDuoArr = [
          { 1: "中原" },
          { 2: "河北" },
          { 3: "吴越" },
          { 4: "西北" },
          { 5: "巴蜀" },
          { 6: "荆楚" },
        ]),
          (this.fenduoData = []);
        for (var t, i = 0; i < this.fenDuoArr.length; i++) {
          var n = i + 1;
          (t = { item_fenduo_name: { text: this.fenDuoArr[i][n] } }),
            this.fenduoData.push(t);
        }
        (this.list_mem_fenduo.visible = !0),
          (this.list_mem_fenduo.dataSource = this.fenduoData);
      }),
      (t.prototype.onBangPaiMemberAction = function (e) {
        if ("" != e.target.name) {
          var t = this.list_bangpai_member.selectedIndex + 2,
            i = this.dataArr[this.list_bangpai_member.selectedIndex];
          (this.label_fac_mem_name.text = i[t]),
            (this.list_bangpai_member.visible = !1),
            (this.list_mem_fenduo.visible = !1),
            -1 != i[t].indexOf("舵主")
              ? ((this.label_fenduo_name.visible = !0),
                (this.label_fenduo_down.visible = !0),
                (this.label_fenduo_title.visible = !0))
              : ((this.label_fenduo_name.visible = !1),
                (this.label_fenduo_down.visible = !1),
                (this.label_fenduo_title.visible = !1));
        } else this.list_bangpai_member.visible = !1;
      }),
      (t.prototype.onBangPaiFenDuoAction = function (e) {
        if ("" != e.target.name) {
          var t = this.list_mem_fenduo.selectedIndex + 1,
            i = this.fenDuoArr[this.list_mem_fenduo.selectedIndex];
          (this.label_fenduo_name.text = i[t]),
            (this.list_mem_fenduo.visible = !1);
        } else this.list_mem_fenduo.visible = !1;
      }),
      (t.prototype.onDidMemOperationAction = function (e) {
        if ("item_cancel" == e.target.name) this.close();
        else {
          if (this.list_bangpai_member.selectedIndex < 0)
            return void ToastView.toastView("请选择职位");
          var t = this.list_bangpai_member.selectedIndex + 2 + "",
            i = void 0,
            n = "0";
          if (
            ((i = t),
            -1 !=
              this.dataArr[this.list_bangpai_member.selectedIndex][t].indexOf(
                "舵主"
              ))
          ) {
            if (this.list_mem_fenduo.selectedIndex < 0)
              return void ToastView.toastView("请选择分舵");
            var a = this.list_mem_fenduo.selectedIndex + 1 + "";
            this.fenDuoArr[this.list_mem_fenduo.selectedIndex];
            n = a;
          }
          WebSocketService.send({
            c: 1233,
            d: { id: Global.bangpaiID, rid: this.jsonObj.id, s: i, d: n },
          });
        }
      }),
      (t.prototype.onLoadMemableManagerData = function (e) {
        this.close(),
          0 == e.code
            ? ToastView.toastView("任命成功")
            : ToastView.toastView(e.msg);
      }),
      t
    );
  })(ui.FactionController.FactionMembersDialogUI);
